-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added the junit test cases for CustomSearchNarrowingInterceptor #70
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you review the built-in tests for SearchNarrowingInterceptor?
Testing the "rule" is not sufficient. There should be practical tests using resource search, etc.
…r-jpaserver-starter into junit-tests-for-CustomSearchNarrowingInterceptor
public void before() throws IOException { | ||
MockitoAnnotations.openMocks(this); | ||
ourReturn = Collections.emptyList(); | ||
ourLastHitMethod = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why would you want to test the "last hit method"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have followed the upstream repo tests, as when we search for fhirResource( observation or patient ), the variable ourLastHitMethod
will return the method name we have hit so it helps to verify right method has been called during execution.
@Override | ||
protected AuthorizedList buildAuthorizedList(RequestDetails theRequestDetails) { | ||
try (MockedStatic<OAuth2Helper> mockedStatic = mockStatic(OAuth2Helper.class)) { | ||
mockedStatic.when(() -> OAuth2Helper.hasToken(any())).thenReturn(true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mocking, and replacing, the functionality of the OAuth2Helper invalidates the entire test. Tests SHOULD NOT know about the helper.
…r-jpaserver-starter into junit-tests-for-CustomSearchNarrowingInterceptor
Overview
How it was tested
Checklist